{extend name='base' /}
{block name='content'}
<body>
<div class="x-body">
    <form class="layui-form" id="AddData">
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>分类名称
            </label>
            <div class="layui-input-inline">
                <input type="text"  name="cate_name" required="" lay-verify="required"
                       autocomplete="off" value="" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>文章区别类型的标识
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>是否启用
            </label>
            <div class="layui-input-block">
                <input type="checkbox" name="status" lay-skin="switch"  lay-text="否|是" checked>
            </div>
        </div>


        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <a  class="layui-btn" href="javascript:Add();" >
                增加
            </a>
        </div>
    </form>
</div>
<script>
function Add() {
   $.ajax({
       url:"{:url('category/add')}",
       type:'post',
       dataType:'json',
       data:$('#AddData').serialize(),
       success:function (res) {
           if (res.code==1){
               layer.msg(res.message,{icon:6});
               setTimeout(function () {
                   x_admin_close();
                   window.parent.location.reload();
               },1000)
           } else{
               layer.msg(res.message,{icon:2,time:1000})
           }
       },
       error:function () {
           layer.msg('出错了，请稍后再试！',{icon:5,time:1000})
       }
   })
}
</script>
</body>
{/block}